import { useTranslation } from "react-i18next";

const useI18n = () => {
    const { i18n, t } = useTranslation();

    const changeLanguage = (lang: string) => {
        i18n.changeLanguage(lang);
    };

    // 获取所有可用的语言选项
    const getLanguageOptions = () => {
        return [
            { value: "zh", label: "中文" },
            { value: "en", label: "English" },
            { value: "ko", label: "한국어" },
            { value: "ja", label: "日本語" },
        ];
    };

    return {
        t,
        lang: i18n.language,
        changeLanguage,
        getLanguageOptions,
    };
};

export default useI18n;
